﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Group3.MediaTool.Interface
{
    /// <summary>
    /// Version: 1.0
    /// @Author: P. Senjic
    /// @Comment:
    ///     IDataProvider is the communication interface for the ObjectRelationModel objects.
    ///     The interface provides methods for read and write to a DataStore.
    ///     It also has properties to specify the connection attributes.
    /// </summary>
    public interface IDataProvider<IObjectRelationModel>
    {
        e_DataStoreProvider StoreProvider { get; set; }
        /// <summary>
        /// Connect represents a connection string.
        /// For DataBase this is the real connectionstring.
        /// For FileBased Systems, this should specify the location of the File.
        /// </summary>
        String Connect { get; set; }
        /// <summary>
        /// Store is the real DataStore.
        /// In Sql Server this is the Database.
        /// For a Filebased System, this should be the File
        /// </summary>
        String Store { get; set; }
        /// <summary>
        /// allows an execution of a method within the current Store.
        /// this could be used to call a database function or for special queries or calculation.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="action"></param>
        /// <returns>True, if the execution was successfull</returns>
        bool ExecuteAction<T>(Action<T> action, T parameter);

        IEnumerable<IObjectRelationModel> GetDataFromStore<T>() where T : IObjectRelationModel;
        IEnumerable<IObjectRelationModel> GetDataFromStore<T>(Predicate<T> filterstmt) where T : IObjectRelationModel;

        bool SaveChanges(IObjectRelationModel orm);
    }
}
